import { message } from 'antd';
import { submitForm,queryUpload} from '@/services/bnsConfig/upload';

export default {
  namespace: 'upload',
  state: {
    // 列表数据
    data: { },
    queryForm:{},

  },

  effects: {
    *queryList({ payload }, { call, put }) {
      const response = yield call(queryUpload, payload);
      yield put({
        type: 'save',
        payload: response,
      });
    },

    *submit({ payload, callback }, { call, put }) {
      const response = yield call(submitForm, payload);
      yield put({
        type: 'saveSubmit',
        payload: response,
      });
      if (callback) callback(response);
    },

  },

  reducers: {
    save(state, action) {
      return {
        ...state,
        data: action.payload.data,
      };
    },
  },

};
